package cn.agiledata.bank.common.tag;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;

import org.apache.struts.taglib.TagUtils;

import cn.agiledata.bank.common.dao.AccountTemplate;
import cn.agiledata.bank.common.util.OperateUtil;
import cn.agiledata.bank.hibernateBean.Account;
import com.vnv.infrastructure.logic.IPBAppFactory;

public class ScoreTag extends BodyTagSupport {
	public int doEndTag() throws JspException {
		// TODO Auto-generated method stub
		String accountId = this.getBodyContent().getString();
		AccountTemplate at = (AccountTemplate)IPBAppFactory.getObj("accountTemplate");
		Account account = at.getAccount(accountId);
		if(account.getTotalScores() != null) {
			TagUtils.getInstance().write(this.pageContext,OperateUtil.parseDec(account.getTotalScores(), "##,##0.00"));
		} else {
			TagUtils.getInstance().write(this.pageContext,"");
		}
		return super.doEndTag();
	}
}
